package com.dream.inspect.modules.business.service.impl;

import java.util.Map;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.plugins.Page;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.dream.inspect.common.utils.PageUtils;
import com.dream.inspect.common.utils.Query;
import com.dream.inspect.modules.business.dao.MessageNoticDao;
import com.dream.inspect.modules.business.entity.MessageNoticEntity;
import com.dream.inspect.modules.business.service.MessageNoticService;
import com.dream.inspect.modules.dream.pojo.MessageNoticFormMap;


@Service("messageNoticService")
public class MessageNoticServiceImpl extends ServiceImpl<MessageNoticDao, MessageNoticEntity> implements MessageNoticService {

	@Resource
	private MessageNoticDao messageNoticDao;
	
    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        Page<MessageNoticEntity> page = this.selectPage(
                new Query<MessageNoticEntity>(params).getPage(),
                new EntityWrapper<MessageNoticEntity>()
        );

        return new PageUtils(page);
    }

	@Override
	public PageUtils findList(Map<String, Object> params) {
		Page<MessageNoticFormMap> page = selectThisPage(new Query<MessageNoticFormMap>(params),
                new Query<MessageNoticFormMap>(params).getPage()
        );

        return new PageUtils(page);
	}

	private Page<MessageNoticFormMap> selectThisPage(Map<String ,Object> map, Page<MessageNoticFormMap> page) {
        page.setRecords(messageNoticDao.findList(map,page));
        return page;
    }
	
}
